package com.viethp.mt.objects;

import org.ksoap2.serialization.SoapObject;

public class OItem {
	private static final String XML_ID = "id";
	private static final String XML_USER_ID = "user_id";
	private static final String XML_USERNAME = "username";
	private static final String XML_TITLE = "title";
	private static final String XML_DESCRIPTION = "description";
	private static final String XML_EXP = "expired";
	private static final String XML_PRICE = "price";
	private static final String XML_LON = "longitude";
	private static final String XML_LAT = "latitude";
	private static final String XML_IMG_LINK = "imgLink";
	private static final String XML_MAX_BUDGET = "max_budget";
	private static final String XML_TOTAL_BIDDER = "total_bidder";
	private static final String XML_CATEGORY_ID = "category_id";
	private int id, user_id, total_bidder, category_id;
	private String title, description, username, imgLink;
	private int exp, price;
	private double lon, lat;
	private long created, modified;
	private String  max_budget;

	public OItem(int id, int user_id, String username, String title,
			String description, int exp, int price, double lon, double lat,
			long created, long modified) {
		this.id = id;
		this.user_id = user_id;
		this.username = username;
		this.title = title;
		this.description = description;
		this.exp = exp;
		this.price = price;
		this.lon = lon;
		this.lat = lat;
		this.created = created;
		this.modified = modified;
	}

	public OItem(SoapObject OItem) {
		if (OItem != null && OItem.hasProperty(XML_ID)) {
			this.id = Integer.parseInt(OItem.getProperty(XML_ID).toString());
			this.user_id = Integer.parseInt(OItem.getProperty(XML_USER_ID)
					.toString());
			this.username = OItem.getProperty(XML_USERNAME).toString();
			this.title = OItem.getProperty(XML_TITLE).toString();
			this.description = OItem.getProperty(XML_DESCRIPTION).toString();
			this.exp = Integer.parseInt(OItem.getProperty(XML_EXP).toString());
			this.price = Integer.parseInt(OItem.getProperty(XML_PRICE)
					.toString());
			this.lon = Double
					.parseDouble(OItem.getProperty(XML_LON).toString());
			this.lat = Double
					.parseDouble(OItem.getProperty(XML_LAT).toString());
			this.imgLink = OItem.getProperty(XML_IMG_LINK).toString();
			this.max_budget = OItem
					.getProperty(XML_MAX_BUDGET).toString();
			this.total_bidder = Integer.parseInt(OItem.getProperty(
					XML_TOTAL_BIDDER).toString());
			this.category_id = Integer.parseInt(OItem.getProperty(
					XML_CATEGORY_ID).toString());
		}
	}

	// set
	public void setId(int id) {
		this.id = id;
	}

	public void setCategoryId(int id) {
		this.category_id = id;
	}

	public void setMaxBudget(String budget) {
		this.max_budget = budget;
	}

	public void setTotalBidder(int bidder) {
		this.total_bidder = bidder;
	}

	public void setUserId(int user_id) {
		this.user_id = user_id;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setImgLink(String link) {
		this.imgLink = link;
	}

	public void setExp(int exp) {
		this.exp = exp;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public void setLon(double lon) {
		this.lon = lon;
	}

	public void setLat(double lat) {
		this.lat = lat;
	}

	public void setCreated(long created) {
		this.created = created;
	}

	public void setModified(long modified) {
		this.modified = modified;
	}

	// get
	public int getId() {
		return this.id;
	}

	public int getCategoryId() {
		return this.category_id;
	}

	public String getMaxBudget() {
		return this.max_budget;
	}

	public int getTotalBidder() {
		return this.total_bidder;
	}

	public int getUserId() {
		return this.user_id;
	}

	public String getUsername() {
		return this.username;
	}

	public String getTitle() {
		return this.title;
	}

	public String getDescription() {
		return this.description;
	}

	public String getImgLink() {
		return this.imgLink;
	}

	public int getExp() {
		return this.exp;
	}

	public int getPrice() {
		return this.price;
	}

	public double getLon() {
		return this.lon;
	}

	public double getLat() {
		return this.lat;
	}

	public long getCreated() {
		return this.created;
	}

	public long getModified() {
		return this.modified;
	}
}
